var web3 = require('./getWeb3');
var BigNumber = require('bignumber.js');
var Tx = require('ethereumjs-tx').Transaction;


var privateKey = Buffer.from('b1b9fb7cdf8217481a3543743ec1360b249b002ff845d08e65e710cfd9e8d833', 'hex');

var rawTx = {
   nonce: web3.utils.toHex(6),
   gasPrice: web3.utils.toHex(web3.utils.toWei('20','gwei')),
   gasLimit: web3.utils.toHex('3000000'),
   to: '0x95BD05C148c0baCA5527422bb76cC0d6A029f3e9',
   data: '0xa9059cbb000000000000000000000000b8fd46e23c29d840242cab2b3f1346312781a24c00000000000000000000000000000000000000000000000000000000000f4240'
 }

var tx = new Tx(rawTx, {'chain':'ropsten'});
tx.sign(privateKey);

var serializedTx = tx.serialize();

web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'),(error,hash)=>{
			if(!error){
				console.log(hash)
			}else{
				console.log(error)
			}
		})